import { CheckBox } from "std-widgets.slint";
import { Callabler } from "callabler.slint";
import { Translations } from "translations.slint";
import { PopupBase } from "popup_base.slint";
import { PopupCenteredText } from "popup_centered_text.slint";

export component PopupMoveFolders inherits Rectangle {
    out property <length> popup_width: 500px;
    out property <length> popup_height: 150px;
    in-out property <string> folder_name: "";
    callback show_popup();

    popup_window := PopupBase {
        width: popup_width;
        height: popup_height;
        title_text <=> Translations.popup_move_title_text;

        VerticalLayout {
            PopupCenteredText {
                text: Translations.popup_move_message_text + "\n" + folder_name;
            }

            Rectangle {height: 5px;}

            VerticalLayout {
                HorizontalLayout {
                    alignment: center;
                    copy_checkbox := CheckBox {
                        text <=> Translations.popup_move_copy_checkbox_text;
                    }
                }
                Rectangle {height: 5px;}

                HorizontalLayout {
                    alignment: center;
                    preserve_folder_checkbox := CheckBox {
                        text <=> Translations.popup_move_preserve_folder_checkbox_text;
                    }
                }
            }
            Rectangle {height: 20px;}

            PopupCenteredText {
                text: Translations.are_you_want_to_continue_text;
            }
        }

        ok_clicked => {
            Callabler.move_items(preserve_folder_checkbox.checked, copy_checkbox.checked, folder_name);
        }
    }

    show_popup() => {
        popup_window.show();
    }
}
